<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<?php
    $mysql_server_name="bk.shiliang.org"; //数据库服务器名称
    $mysql_username="puhuiwww"; // 连接数据库用户名
    $mysql_password="puhuiwww0539"; // 连接数据库密码
    $mysql_database="puhuiwww"; // 数据库的名字
    // 连接到数据库
    $conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
	mysql_select_db($mysql_database,$conn);
	mysql_query("set names 'utf8'");
?>
<style>
 .points {width:98%; margin:0px; padding:0px; border-bottom:1px solid #f2efe9; overflow:hidden;}
 .points dl { list-style:none; margin:0px; padding:0px; width:48%; text-align:center; float:left; font-size:12px;}
 .points dl dt { list-style:none;  margin:0px; padding:0px; height:63px;}
 .points dl dd { list-style:none; margin:0px 0 10px 0; padding:0px 0 0 0px; width:100%; color:#3b97d3; font-size:24px; font-weight:lighter; float:left;  line-height:30px; height:30px; text-align:center;}
 .points dl span { font-weight:800;}
 .line-right { border-right:1px solid #f2efe9; height:54px; }

</style>

</head>
<body>

<div class="points">

<?php

$username=$_GET['username'];
$username="puhui";
//上一天

$nowday=date("Y-m-d",time());
$ytoday=date("Y-m-d",strtotime("-1 day"));

$today=date("Y-m-d");
$yestoday=date("Y-m-d",strtotime("-1 day"));

$nowday=strtotime($nowday);
$ytoday=strtotime($ytoday);
if($username='admin'){
	$sql="select sum(pl_points) as ypoints from shopwwi_points_log where  pl_stage='order' and pl_addtime between ".$ytoday." and ".$nowday."";
	}else{
$sql="select sum(pl_points) as ypoints from shopwwi_points_log where pl_membername='".$username."' and pl_stage='order' and pl_addtime between ".$ytoday." and ".$nowday."";
}
$res=mysql_query($sql);
$row=mysql_fetch_array($res);
if($username='admin'){
$sql_lo="select sum(pl_points) as ypoints from shopwwi_points_log where  pl_stage='login' and pl_addtime between ".$ytoday." and ".$nowday."";

}else{
$sql_lo="select sum(pl_points) as ypoints from shopwwi_points_log where pl_membername='".$username."' and pl_stage='login' and pl_addtime between ".$ytoday." and ".$nowday."";
}
$res_lo=mysql_query($sql_lo);
$row_lo=mysql_fetch_array($res_lo);
if($username='admin'){
	$sql_re="select sum(pl_points) as ypoints from shopwwi_points_log where  pl_stage='regist' and pl_addtime between ".$ytoday." and ".$nowday."";

}else{
$sql_re="select sum(pl_points) as ypoints from shopwwi_points_log where pl_membername='".$username."' and pl_stage='regist' and pl_addtime between ".$ytoday." and ".$nowday."";
}
$res_re=mysql_query($sql_re);
$row_re=mysql_fetch_array($res_re);
$allpoints=$row['ypoints']+$row_lo['ypoints']+$row_re['ypoints'];

echo "<dl class='line-right'><span>上一天新增白积分总量：</span><dd>".$allpoints."</dd></dl>";

if($username='admin'){
$sql_f="select sum(pl_points) as rpoints from shopwwi_points_log where pl_stage='backpoints' and pl_addtime between ".$ytoday." and ".$nowday."";

}else{
$sql_f="select sum(pl_points) as rpoints from shopwwi_points_log where pl_membername='".$username."' and pl_stage='backpoints' and pl_addtime between ".$ytoday." and ".$nowday."";
}
$res=mysql_query($sql_f);
$row=mysql_fetch_array($res);
$s_row = $row['rpoints'];
if($s_row ==null ){
	$s_row = 0;
}

	
echo "<dl class='line-right' ><span>上一天返还积分总量：</span><dd>".$s_row."</dd></dl>";

echo "<dl class='line-right'><span>上一天全返单元总量：</span><dd>".$s_row."</dd></dl>";

//上一天每单元返还积分数

$sql="select * from shopwwi_returnpoint where addtime = '".$yestoday."'";

$res_sr=mysql_query($sql);
$row_sr=mysql_fetch_array($res_sr);
$s_row_sr = $row_sr['back_point'];
if($s_row_sr =="" ){
	$s_row_sr = 0;
}

echo "<dl><span>上一天每单元返还积分数：</span><dd>".$s_row_sr."</dd></dl>";


?>
</div>

</body>
</html>